﻿@using Seal.Model
@{
    ReportView view = Model;
    Report report = view.Report;
    ReportModel reportModel = view.Model;
    bool activeFirst = true;
}

@if (reportModel.SummaryTable != null && reportModel.SummaryTable.RowCount > 0 && view.GetBoolValue("show_summary_table"))
{
    activeFirst = false;
    <div class="tab-pane fade in active container@(report.ExecutionView.GetBoolValue("container_fluid") ? "-fluid" : "")" id="@(view.IdSuffix + "_summary")">
        @Include(view.GetPartialTemplateKey("Model.iSummaryTable", view), view)
    </div>
    if (report.PrintLayout && view.GetBoolValue("print_break_after_page"))
    {
        <div style="page-break-after: always;"></div>
    }
}

@foreach (ResultPage page in reportModel.Pages)
{
    report.CurrentPage = page;
    if (report.PrintLayout && view.GetBoolValue("print_break_after_page") && page != reportModel.Pages[0])
    {
        <div style="page-break-after: always;"></div>
    }

    var className = "";
    if (reportModel.Pages.Count > 1 && !report.PrintLayout && view.GetValue("model_menu_type") != "none")
    {
        className = "tab-pane fade" + (activeFirst ? "in active" : "");
        activeFirst = false;
    }

    <div class="container-fluid @className" id="@(view.IdSuffix + page.PageId)">
        @Raw(view.ParseChildren())

        @if (view.GetBoolValue("show_page_separator"))
        {
            <hr style="display: block;" />
        }
    </div>
}
